<?php

$loader = new \Phalcon\Loader();

/**
 * Register Namespaces
 */
$loader->registerNamespaces([
    'Admin\Models'      => APP_PATH . '/common/models/',
    'Admin'             => APP_PATH . '/common/library/',
//    'Helpers'           => APP_PATH . '/common/library/Helpers/',
    'Helpers'           => APP_PATH . '/helpers/',
//    'Services'          => APP_PATH . '/common/services/',
    'Services'          => APP_PATH . '/services/',
    'Modules'           => APP_PATH . '/common/modules/',
    'Flow'              => APP_PATH . '/common/library/Flow/'
]);

/**
 * Register module classes
 */
//$loader->registerClasses([
//    'Admin\Frontend\Module' => APP_PATH . '/modules/frontend/Module.php',
//    'Admin\Api\Module'      => APP_PATH . '/modules/api/Module.php',
//    'Admin\Cli\Module'      => APP_PATH . '/modules/cli/Module.php',
//]);

//$eventsManager = new \Phalcon\Events\Manager();
//$eventsManager->attach('loader', function($event, $loader) {
//    if ($event->getType() == 'beforeCheckPath') {
//        echo $loader->getCheckedPath() .'<br/>';
//    }
//});
//$loader->setEventsManager($eventsManager);

$loader->register();